import type { DataDictionaryDto, DataDictionaryResultDto, DataDictionaryResultRequestDto } from '@/models/data-dictionary';
import type { EntityDto } from '@/models/entity';
import { httpApi } from '@/utils/axios/http';
import url from '@/utils/axios/url';

export function getDataDictionariesApi(code?: string): Promise<Array<DataDictionaryResultDto>> {
    return httpApi.httpGet({ url: url.dataDictionary, params: { code: code } });
}

export function getDataDictionaryApi(id: number): Promise<DataDictionaryResultDto> {
    return httpApi.httpGet({ url: url.dataDictionary + '/' + id });
}

export function postDataDictionaryApi(input: DataDictionaryDto): Promise<DataDictionaryDto> {
    return httpApi.httpPost({ url: url.dataDictionary, params: input });
}

export function putDataDictionaryApi(input: DataDictionaryDto): Promise<DataDictionaryDto> {
    return httpApi.httpPut({ url: url.dataDictionary, params: input });
}

export function deleteDataDictionaryApi(id: number): Promise<EntityDto> {
    return httpApi.httpDelete({ url: url.dataDictionary + '/' + id });
}